<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath }"/>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>低值资产管理系统</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta content="width=device-width, initial-scale=1.0" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	<meta name="MobileOptimized" content="320">
	<!-- BEGIN GLOBAL MANDATORY STYLES -->          
	<link href="${ctx}/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
	<!-- END GLOBAL MANDATORY STYLES -->
	<!-- BEGIN THEME STYLES --> 
	<link href="${ctx}/assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/style.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/plugins.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/themes/light.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/custom.css" rel="stylesheet" type="text/css"/>
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/bootstrap-daterangepicker/daterangepicker-bs3.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/bootstrap-datetimepicker/css/datetimepicker.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/jquery-multi-select/css/multi-select.css" />
	<link href="${ctx }/assets/plugins/jquery-file-upload/css/jquery.fileupload-ui.css" rel="stylesheet" />
	<link href="${ctx}/assets/plugins/bootstrap-modal/css/bootstrap-modal-bs3patch.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/plugins/bootstrap-modal/css/bootstrap-modal.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx }/css/custom.css" rel="stylesheet" type="text/css"/>
	<!-- END THEME STYLES -->
	<link rel="shortcut icon" href="favicon.ico" />
	<style type="text/css">
		.page-content{
			min-height:900px;
		}
	</style>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed">
	<!-- BEGIN HEADER -->
	<%@include file="../include/header.jsp" %>
	<!-- END HEADER -->
	<div class="clearfix"></div>
	<!-- BEGIN CONTAINER -->
	<div class="page-container">
		<!-- BEGIN SIDEBAR -->
		<%@include file="../include/sidebar.jsp" %>
		<!-- END SIDEBAR -->
		<!-- BEGIN PAGE -->
		<div class="page-content">			          
			<!-- BEGIN PAGE HEADER-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->
					<h3 class="page-title">
						资产盘点
					</h3>					
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
			</div>
			<!-- END PAGE HEADER-->
			<!-- BEGIN PAGE CONTENT-->          
			<div class="row">
				<div class="col-md-12">
					
					<!-- BEGIN SAMPLE TABLE PORTLET-->
					<div class="portlet box green">
						<div class="portlet-title">
							<div class="caption"><i class="fa fa-cogs"></i>盘点异常物资查询</div>
							<div class="tools">
								<a href="javascript:;" class="collapse"></a>
							</div>
						</div>
						<div class="portlet-body flip-scroll">
							<form class="form-horizontal" id="chaXun" method="POST" action="${ctx }/wuzi/ziChanPanDianCXXQB.do" target="_blank">
								<div class="col-md-12">
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">使用部门</label>
											<div class="col-md-4">
												<select id="depId" name="depId" class="form-control">
													<option value="">全部</option>
													<c:forEach items="${depList }" var="u">
														<option value="${u.id}"><c:forEach var="item" varStatus="status" begin="1" end="${u.cengJi}">&nbsp;&nbsp;&nbsp;&nbsp;</c:forEach>${u.depName}</option>
													</c:forEach>
												</select>
											</div>
											<label class="col-md-2 control-label">使用人</label>
											<div class="col-md-4">
												<select name="userId" id="userId" class="form-control"></select>
											</div>
										</div>									
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">物资名称</label>
											<div class="col-md-4">
												<input type="text" class="form-control" name="wuZiMC" placeholder="物资名称">
											</div>
											<label class="col-md-2 control-label">规格型号</label>
											<div class="col-md-4">
												<input type="text" class="form-control" name="guiGeXH" placeholder="规格型号">
											</div>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">产品序列号</label>
											<div class="col-md-4">
												<input type="text" class="form-control" name="chanPinXLH" placeholder="产品序列号">
											</div>
											<label class="col-md-2 control-label">物资类型</label>
											<div class="col-md-4">
												<select name="wuZiLX" class="form-control">
													<option value="">全部</option>
													<option value="1">低值资产</option>
													<option value="2">低值易耗品</option>
												</select>
											</div>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">盘点状态</label>
											<div class="col-md-4">
												<select name="panDian" class="form-control">
													<option value="">全部</option>
													<option value="0">盘点正常</option>
													<option value="1">盘点中</option>
													<option value="2">盘点丢失</option>
													<option value="3">补办移交</option>
													<option value="4">实物盘点</option>
													<option value="5">盘点报废</option>
													<option value="8">盘点终止</option>
												</select>
											</div>
										</div>
									</div>
								</div>
							</form>								
							<div style="text-align:right;">
								<form class="form-horizontal" method="POST" action="${ctx }/wuzi/panDianFuJian.do" enctype="multipart/form-data" id="fuJianForm" role="form">
									<a class="btn blue" id="daoChuAN"><i class="fa fa-search"></i>&nbsp;&nbsp;下载盘点文件</a>&nbsp;&nbsp;
									<span class="btn green fileinput-button"><i class="fa fa-plus"></i><span>选择文件</span><input type="file" name="file"></span>&nbsp;&nbsp;
									<button type="button" onclick="if(validateForm()) document.getElementById('fuJianForm').submit();return false" class="btn blue start">
										<i class="fa fa-upload"></i><span>上传盘点结果</span></button>&nbsp;&nbsp;								
									<a class="btn green" id="faQiPanDian"><i class="fa fa-search"></i>&nbsp;&nbsp;发起盘点通知</a>&nbsp;&nbsp;
									<a class="btn blue" id="daoChuAN2"><i class="fa fa-search"></i>&nbsp;&nbsp;导出盘点结果</a>&nbsp;&nbsp;
									<a class="btn blue" id="tingZhi"><i class="fa fa-search"></i>&nbsp;&nbsp;停止盘点</a>&nbsp;&nbsp;
									<a class="btn blue" onclick="document.getElementById('chaXun').submit();"><i class="fa fa-search"></i>&nbsp;&nbsp;查看详情表</a>&nbsp;&nbsp;
									<a class="btn blue" id="chaXunAN"><i class="fa fa-search"></i>&nbsp;&nbsp;查询</a>&nbsp;&nbsp;
									<a class="btn default" onclick="$('#chaXun')[0].reset()"><i class="fa fa-search"></i>&nbsp;&nbsp;重置</a>
								</form>
							</div>								
							
						</div>
					</div>
					<div class="portlet-body flip-scroll">
						<table class="table table-bordered table-striped table-condensed flip-content">
							<thead class="flip-content">
								<tr>
									<th>序号</th>
									<th>资产编号</th>
									<th>物资类别</th>
									<th>物资名称</th>
									<th>规格型号</th>
									<th>产品序列号</th>
									<th>使用部门</th>
									<th>使用人</th>
									<th>物资类型</th>
									<th>盘点状态</th>
									<th>上次盘点日期</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody id="ziChanPanDianLists"></tbody>
						</table>
					</div>					
				</div>
			</div>			
		<!-- END PAGE -->
		</div>
	</div>
	<!-- END CONTAINER -->
	<!-- BEGIN FOOTER -->
	<%@include file="../include/footer.jsp" %>
	<!-- END FOOTER -->
	<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
	<!-- BEGIN CORE PLUGINS -->   
	<!--[if lt IE 9]>
	<script src="${ctx}/assets/plugins/respond.min.js"></script>
	<script src="${ctx}/assets/plugins/excanvas.min.js"></script> 
	<![endif]-->   
	<script src="${ctx}/assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>    
	<script src="${ctx}/assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/bootstrap-hover-dropdown/twitter-bootstrap-hover-dropdown.min.js" type="text/javascript" ></script>
	<script src="${ctx}/assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/jquery.blockui.min.js" type="text/javascript"></script>  
	<script src="${ctx}/assets/plugins/jquery.cookie.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript" ></script>

	<script src="${ctx}/assets/scripts/form-components.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/clockface/js/clockface.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-daterangepicker/moment.min.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
	<script src="${ctx}/assets/plugins/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/bootstrap-modal/js/bootstrap-modalmanager.js" type="text/javascript" ></script>
	<script src="${ctx}/assets/plugins/bootstrap-modal/js/bootstrap-modal.js" type="text/javascript" ></script>
	<script src="${ctx}/assets/scripts/ui-extended-modals.js"></script>
	<!-- END CORE PLUGINS -->
	<script src="${ctx}/assets/scripts/app.js"></script>      
	<script>
		jQuery(document).ready(function() {       
		   // initiate layout and plugins
		   App.init();
		   $('#F').addClass("active");
		   $.ajax({
				type:"POST",
				data:$('#chaXun').serialize(),
				url:"${ctx}/wuzi/ziChanPanDianCX.do",
				success:function(data){
					$('#ziChanPanDianLists').html(data);
				}
			});
		});
		
		$('#chaXunAN').bind("click",function(){
			$.ajax({
				type:"POST",
				data:$('#chaXun').serialize(),
				url:"${ctx}/wuzi/ziChanPanDianCX.do",
				async:false,
				success:function(data){
					$('#ziChanPanDianLists').html(data);
				}
			});
		});
		
		$('#tingZhi').bind("click",function(){
			$.ajax({
				type:"POST",
				url:"${ctx}/wuzi/stopPanDian.do",
				async:false,
				success:function(data){
					$.ajax({
						type:"POST",
						data:$('#chaXun').serialize(),
						url:"${ctx}/wuzi/ziChanPanDianCX.do",
						success:function(data){
							$('#ziChanPanDianLists').html(data);
							alert("停止盘点成功，请查看状态为“盘点停止”的物资。");
						}
					});
				}
			});
		});
		
		$('#daoChuAN').bind("click",function(){
			var _CTX="${ctx}";
			$.ajax({
				type:"POST",
				data:$('#chaXun').serialize(),
				url:"${ctx}/wuzi/daoChu4.do",
				async:false,
				success:function(data){					
					window.open(_CTX+data,'_blank');
				}
			});
		});
		
		$('#daoChuAN2').bind("click",function(){
			var _CTX="${ctx}";
			$.ajax({
				type:"POST",
				data:$('#chaXun').serialize(),
				url:"${ctx}/wuzi/daoChu5.do",
				async:false,
				success:function(data){					
					window.open(_CTX+data,'_blank');
				}
			});
		});
		
		$('#faQiPanDian').bind("click",function(){
			if(window.confirm('您确认要发起盘点吗？')){
				$.ajax({
					type:"POST",
					url:"${ctx}/wuzi/faQiPanDian.do",
					async:false,
					success:function(data){
						$.ajax({
							type:"POST",
							data:$('#chaXun').serialize(),
							url:"${ctx}/wuzi/ziChanPanDianCX.do",
							success:function(data){
								$('#ziChanPanDianLists').html(data);
							}
						});
					}
				});
			}else{				
			}
		});
		
		function danDuPanDian(id){
			if(window.confirm("您确认要发起盘点吗？")){
				$.ajax({
					type:"POST",
					url:"${ctx}/wuzi/danDuPanDian.do",
					data:{
						"id":id
					},
					dataType:"json",
					async:false,
					success:function(data){
						$.ajax({
							type:"POST",
							data:$('#chaXun').serialize(),
							url:"${ctx}/wuzi/ziChanPanDianCX.do",
							success:function(data){
								$('#ziChanPanDianLists').html(data);
							}
						});
					}
				});
			}
		}
		
		$('#depId').bind("change",function(){
			$.ajax({
				type:"POST",
				url:"${ctx}/system/getUserByDep1.do",
				data:{
					"depId":$('#depId').val()
				},
				async:false,
				success:function(data){
					$('#userId').html(data);
				}
			});
		});
		
		function validateForm() {
			//validate方法参数可选  
			return $("#fuJianForm").validate({
				errorElement: 'span', //default input error message container
	            errorClass: 'help-block', // default input error message class
	            focusInvalid: false, // do not focus the last invalid input
				rules : {					
					file : {
						required : true
					}
				},
				messages : {
					file : {
						required:'请选择文件'						
					}
				},
				
				highlight: function (element) { // hightlight error inputs
	                $(element)
	                    .closest('.form-group').addClass('has-error'); // set error class to the control group
	            },

	            success: function (label) {
	                label.closest('.form-group').removeClass('has-error');	                
	                label.remove();	                
	            },

	            errorPlacement: function (error, element) {
	                error.insertAfter(element.closest('.input-icon'));	                
	            }
			}).form();			
		}
		
	</script>
</body>
<!-- END BODY -->
</html>